package com.deer.wms.base.system.web.billsend;

import com.deer.wms.base.system.model.bill.BillInSapDetail;
import com.deer.wms.base.system.service.bill.BillInSapDetailService;
import com.deer.wms.base.system.webservice.client.MM101SendSAPDto;
import com.deer.wms.common.core.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/billSend")
public class MM101Controller extends BaseController {

    @Autowired
    private BillInSapDetailService billInSapDetailService;


    @ResponseBody
    @RequestMapping("list")
    public String billsend() throws Exception{
        List<BillInSapDetail> billinsend = billInSapDetailService.billInOkSendToSAP();
        System.out.println(billinsend);
        StringBuilder s=new StringBuilder();
//        for (BillInSapDetail b:billinsend
//             ) {
            //MM101Send billSend=new MM101Send();
//            SimpleDateFormat s1=new SimpleDateFormat("yyyyMMdd");
//            Date parse1 = s1.parse(b.getCreateTime1());
//            String format1 = s1.format(parse1);
//            Date parse2 = s1.parse(b.getCreateTime2());
//            String format2 = s1.format(parse2);
//            MM101Send bs=new MM101Send();
//            MM101_ZDATA_MKPF head = new MM101_ZDATA_MKPF();
//            head.setWMSHN(b.getVBELN2());
//            head.setBLDAT(format2);
//            head.setBUDAT(format1);
//            if(b.getLFART().equals("EL")){
//                head.setBWART("101");
//            }else {
//                head.setBWART("161");
//            }
//
//
//            MM101Detail item = new MM101Detail();
//            item.setWMSHN(b.getVBELN2());
//            item.setWMSIN(b.getLIFNR());
//            item.setMATNR(b.getMATNR());
//            item.setWERKS(b.getWERKS());
//            item.setLGORT(b.getLGORT());
//            item.setERFMG(b.getRemain()+"");
//            item.setERFME(b.getMEINS());
//            item.setEBELN(b.getVBELN1());
//            item.setEBELP(b.getLGMNG()+"");

//            bs.setHEAD(head);
//            bs.setITEM(item);
//            Gson gson = new Gson();
//
//            s.append(gson.toJson(bs));

//        }
//        System.out.println(s.toString());
//        return s.toString();
        return null;
    }
}
